<template>
  <view class="cont" v-if="item">
    <view class="top-img" >
      <image :src="this.$store.state.imgBaseUrl + '/join-big-1.png'" v-if="item.additionalStatus == 0 "></image>
      <image :src="this.$store.state.imgBaseUrl + '/join-big-2.png'" v-if="item.additionalStatus == 2 || item.additionalStatus == 3"></image>
      <image :src="this.$store.state.imgBaseUrl + '/store-1.png'" v-if="item.additionalStatus == 1"></image>
    </view>
    <view class="r-text">
      <text>
        {{item.additionalStatus == 0 ? '资质已经提交审核' : item.additionalStatus == 2 ? '资质审核失败' : item.additionalStatus == 3 ? '资质审核驳回' : '审核成功'}}
      </text>
    </view>
    <view class="hint" v-if="item.additionalStatus == 0">
      请耐心等待1-2个工作日，我们会尽快为您审核，请留意您的短信或系统通知！
    </view>
    <view class="hint" v-if="item.additionalStatus == 1">
      您的资质认证已通过平台审核，可以申请店铺认证及聚合收款码申请。
    </view>
    <view class="hint" v-if="item.additionalStatus != 0 && item.additionalStatus != 1">
      <text>{{item.additionalRemark}}</text>
    </view>
    <view class="icon-list" v-if="item.additionalStatus != 0 && item.additionalStatus != 1">
      <view class="box" :class="{over: item.additionalStatus != 0}">
        <image :src="this.$store.state.imgBaseUrl + '/join-sm-2.png'" v-if="item.additionalStatus == 0"></image>
        <image :src="this.$store.state.imgBaseUrl + '/join-sm-1.png'" v-if="item.additionalStatus == 1"></image>
        <image :src="this.$store.state.imgBaseUrl + '/join-sm-3.png'" v-if="item.additionalStatus == 2 || item.additionalStatus == 3"></image>
        <view>
          资质认证
        </view>
      </view>
    </view>
    <view class="footer" v-if="item && item.additionalStatus != 0 && item.additionalStatus != 1">
      <button type="primary" class="sub-btn cur" plain="true" @click="draw">重新申请</button>
    </view>
    <view class="footer" v-if="item && item.additionalStatus == 1">
      <button type="primary" class="sub-btn cur" plain="true" @click="gotoIndex">返回首页</button>
    </view>
  </view>
</template>
<script>
import { findV2ByUserId } from "@/service/certificationReplenish/certificationReplenish.service.js"
export default {
  data() {
    return {
      item: null
    };
  },
  onShow:function() {
    this.getInfo();
  },
  methods: {
    gotoIndex () {
      uni.switchTab({
        url: '/pages/index/index'
      })
    },
    getInfo () {
      findV2ByUserId({}, (res) => {
        if (res.status == 0) {
          if (res.data) {
            if (res.data.joinType !=0 && res.data.additionalStatus == null) {
              uni.redirectTo({
                url: '/pages/certificationReplenish/updateLicense'
              })
            } else {
              if (res.data.joinType == 0) {
                res.data.additionalStatus = res.data.status;
              }
              this.item = res.data;
            }
          }
        } else {
          uni.showToast({
            title: res.msg,
            icon: 'none'
          });
        }
      })
    },
    draw () {
      /**
      additionalStatus: 市场审核状态（0待审核，1审核通过，2审核失败，3驳回）
      **/
      if (this.item.additionalStatus == 2) {
        uni.navigateTo({
          url: '/pages/certificationReplenish/updateLicense'
        })
      } else if (this.item.additionalStatus == 3) {
        uni.navigateTo({
          url: '/pages/certificationReplenish/updateLicense?status=1'
        })
      }
    }
  }
}
</script>

<style scoped lang="scss">
.cont {
  height: 100vh;
  background-color: #FFFFFF;
}
image {
  width: 100%;
  height: 100%;
}
.result {
  padding-top: 40rpx;
  height: 100vh;
  background-color: #FFFFFF;
}
.top-img {
  padding-top: 60rpx;
  image {
    display: block;
    width: 330rpx;
    height: 330rpx;
    margin: 0 auto 30rpx;
  }
}
.r-text {
  text-align: center;
  font-size: 36rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}
.hint {
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
  margin-top: 52rpx;
  text-align: center;
  padding: 0 60rpx;
  line-height: 1.6;
}
.icon-list {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 150rpx;
  .box {
    color: #999999;
    font-size: 29rpx;
    image {
      display: block;
      width: 51rpx;
      height: 51rpx;
      margin: 0 auto 25rpx;
    }
    &.over {
      color: #434343;
    }
  }
  .line {
    width: 87rpx;
    height: 1px;
    background: #E1E1E1;
    margin-left: 18rpx;
    margin-right: 29rpx;
  }
}
.footer {
  width: 100%;
  border-top: 1px solid #E1E1E1;
  padding: 14rpx 0 20rpx;
  background-color: #FFFFFF;
  position: absolute;
  bottom: 0;
  left: 0;
  button {
    height: 70rpx;
    margin: 0 32rpx;
    background-color: #636363;
    font-size: 30rpx;
    line-height: 70rpx;
    color: #ADA697;
    border: none;
    &.cur {
      color: #F6DA99;
      background-color: #434343;
    }
  }
}
</style>
